package com.sky.zero.common.generate.core.base;

import com.github.pagehelper.PageInfo;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;

import java.util.ArrayList;
import java.util.List;

/**
 * 描述:  简单分页实体类 <br>
 */
@Getter
@Setter
@ToString
@NoArgsConstructor
public class SimplePage<T> {

    private int pages;

    private long total;

    private int pageSize;

    private int pageNum;

    private List<T> list;

    public SimplePage(PageInfo<T> page) {
        this.pages = page.getPages();
        this.total = page.getTotal();
        this.pageSize = page.getPageSize();
        this.pageNum = page.getPageNum();
        this.list = page.getList() != null ? page.getList() : new ArrayList<>();
    }

}
